home *** CD-ROM | disk | FTP | other *** search
/ Shareware Extravaganza 7 / Shareware Extravaganza 8 (Most Significant Bits) (Disc 7).iso / win95a / cmd68.zip / WOIO.H < prev    next >
C/C++ Source or Header  |  1996-01-07  |  9KB  |  284 lines

  1. /******************************************************************\
  2. *                                                                  *
  3. *           w       w                oooo                           *
  4. *           w       w  iii  n   n   o    o   n   n  eeee            *
  5. *           w       w   i   nn  n  o      o  nn  n  e               *
  6. *           w   w   w   i   n n n  o      o  n n n  eee             *
  7. *              w w w w    i   n  nn   o    o   n  nn  e               *
  8. *              w   w    iii  n   n    oooo    n   n  eeee            *
  9. *                                                                      *
  10. *     C o m m a n d   L a n g u a g e   I n t e r p r e t e r      *
  11. *                                                                      *
  12. *                                                                      *
  13. *    Written by Lucien Cinc                                         *
  14. *    Copyright (c) 1992, 1993                                       *
  15. *                                                                   *
  16. *                                                                   *
  17. *    For a complete description of all the functions in this file   *
  18. *    see the  WOIO.HLP help file. WOIO.HLP is located in the sub-   *
  19. *    directory WOIO, for example :-                                 *
  20. *                                                                  *
  21. *                    C:\WIN_ONE\WOIO\WOIO.HLP                       *
  22. *                                                                  *
  23. *    Note: To view this  file from  WinOne use the  /4 switch for   *
  24. *          command  TYPE,  since  I use  only  4 spaces  for  tab   *
  25. *          characters, for example :-                               *
  26. *                                                                  *
  27. *                    TYPE WOIO.H /4                                 *
  28. *                                                                   *
  29. \******************************************************************/
  30.  
  31. #ifndef __WOIO_H
  32. #define __WOIO_H
  33.  
  34. #define WIN32_LEAN_AND_MEAN
  35. #include <windows.h>
  36.  
  37. /*
  38.     include stdio.h here so that the macros putchar
  39.     and getchar    can be removed!
  40. */
  41.  
  42. #include <stdio.h>
  43.  
  44. #ifndef _FFBLK_DEF
  45. #define _FFBLK_DEF
  46. struct  ffblk   {
  47.     long            ff_reserved;
  48.     long            ff_fsize;
  49.     unsigned long   ff_attrib;
  50.     unsigned short  ff_ftime;
  51.     unsigned short  ff_fdate;
  52.     char            ff_name[256];
  53. };
  54. #endif
  55.  
  56. #ifdef putchar
  57. #undef putchar
  58. #endif    /* putchar */
  59.  
  60. #ifdef getchar
  61. #undef getchar
  62. #endif    /* getchar */
  63.  
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif  /* __cplusplus */
  67.  
  68. /*
  69.     The system colours below should always be
  70.     used instead of the fix colours. The system
  71.     colours allow the user to change to 
  72.     different colour schemes.
  73. */
  74.  
  75. #define COL_FILENAME    (char )144    /* system text colours */
  76. #define COL_HIGHFNAME    (char )145
  77. #define COL_NUMBER        (char )146
  78. #define COL_TEXT        (char )147
  79. #define COL_HIGHTEXT    (char )148
  80. #define COL_BOLDTEXT    (char )149
  81. #define COL_ENVNAME        (char )150
  82. #define COL_ENVSTR        (char )151
  83. #define COL_ERROR        (char )152
  84. #define COL_LHS            (char )153
  85. #define COL_HIGHLHS        (char )154
  86. #define COL_RHS            (char )155
  87. #define COL_FILEDATE    (char )156
  88. #define COL_FILETIME    (char )157
  89. #define COL_FILEATTRIB    (char )158
  90. #define COL_FILEDESC    (char )159
  91.  
  92. #define BLACK            (char )128   /* fixed text colours */
  93. #define    RED             (char )129
  94. #define GREEN            (char )130
  95. #define BLUE            (char )131
  96. #define YELLOW             (char )132
  97. #define MAGENTA            (char )133
  98. #define CYAN            (char )134
  99. #define WHITE            (char )135
  100. #define LIGHTGRAY        (char )136
  101. #define LIGHTRED        (char )137
  102. #define LIGHTGREEN        (char )138
  103. #define LIGHTBLUE        (char )139
  104. #define BROWN            (char )140
  105. #define LIGHTMAGENTA    (char )141
  106. #define LIGHTCYAN        (char )142
  107. #define DARKGRAY        (char )143
  108.  
  109. /*******************************\
  110. *                                *
  111. *        Control Functions        *
  112. *                                *
  113. \*******************************/
  114.  
  115. #define BUFFERED    1        /* screen output */
  116. #define UNBUFFERED    0
  117.  
  118. void screen(int flag);                    /* buffered screen output */
  119. void yield(void);                        /* alow other tasks to multitask */
  120.  
  121. /*******************************\
  122. *                                *
  123. *     Screen Output Functions    *
  124. *                                *
  125. \*******************************/
  126.  
  127. int  printf(const char *fmt, ...);      /* printf formated output */
  128. int  puts(const char *s);                /* string output + CR-LF */
  129. int  putchar(const int c);                /* character output    */
  130. int  putch(int c);                        /* character output    */
  131. void perror(const char *msg);            /* display an error message    */
  132. void textcolor(int col);                /* set the text colour */
  133.  
  134. void clrscr(void);                        /* clear the screen */
  135. void clreol(void);                        /* clear till end of line */
  136. void gotoxy(int x, int y);                /* position cursor on screen */
  137. int  wherex(void);                        /* location of caret (horizontal) */
  138. int  wherey(void);                        /* location of caret (vertical) */
  139.  
  140. int scrwidth(void);                        /* screen width in characters */
  141. int scrheight(void);                    /* screen height in character */
  142.  
  143. void scrflush(void);                    /* update the screen */
  144. void insline(int line);                    /* insert a line on the screen */
  145. void delline(int line);                    /* delete a line on the screen */
  146. void scroll(int start, int end, int num);    /* scroll area of screen */
  147.  
  148.  
  149. char *atoc(char *number);                /* insert comma's into a number */
  150.  
  151. /*******************************\
  152. *                                *
  153. *         Input Functions        *
  154. *                                *
  155. \*******************************/
  156.  
  157. int  scanf(const char *fmt, ...);        /* scanf formated input    */
  158. char *gets(char *s);                    /* get a string    */
  159. int  getchar(void);                        /* get a character */
  160. int  getch(void);                        /* get a character no echo */
  161.  
  162. /*******************************\
  163. *                                *
  164. *     Command Line Functions        *
  165. *                                *
  166. \*******************************/
  167.  
  168. int  argc(void);                        /* number of arguments */
  169. char *argv(int index);                     /* get an argument */
  170. int  argn(void);                        /* number of switches */
  171. char *args(void);                        /* get all switches */
  172.  
  173. char *argpath(int index);                /* get path argument */
  174. char *argabs(int index);                /* get absolute path argument */
  175. char *argtail(void);                    /* get command line tail */
  176.  
  177. /*******************************\
  178. *                                *
  179. *       Status Bar Functions        *
  180. *                                *
  181. \*******************************/
  182.  
  183. void limit(unsigned long upper);        /* status bar upper limit */
  184. void inc(unsigned long value);            /* status bar increment by value */
  185. void empty(void);                        /* empty status bar */
  186.  
  187. /*******************************\
  188. *                                *
  189. *  File manipulation Functions    *
  190. *                                *
  191. \*******************************/
  192.  
  193. #define INC_BYTE    0    // u_flag's for status bar updating
  194. #define INC_ONE        1
  195. #define INC_NONE    2
  196.  
  197. #define O_OPEN        0    // o_flag's for opening dest file
  198. #define O_CREATE    1
  199. #define O_CREATNEW  2
  200.  
  201. long filesize(char *path);
  202. long filecpy(char *dst, char *src, int o_flag, int u_flag);
  203. long filecat(char *dst, char *src, int u_flag);
  204.  
  205. long filencpy(char *dst, char *src, long num, long offset, int o_flag, int u_flag);
  206. long filencat(char *dst, char *src, long num, long offset, int u_flag);
  207.  
  208. /*******************************\
  209. *                                *
  210. *       File Name Functions        *
  211. *                                *
  212. \*******************************/
  213.  
  214. #define ATT_RHSDA     (unsigned int )(FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_DIREC|FA_ARCH)
  215. #define ATT_RHSA     (unsigned int )(FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH)
  216.  
  217. int fillfile(char *path, unsigned int attr);    /* block file fill */
  218. BOOL getfile(int index, struct ffblk *pff);        /* get file ffblk */
  219. char *getfilepath(int index);                     /* get file path, may not be a fully qualified path */
  220. char *getfilename(int index);                    /* get file name */
  221. char *padfilename(char *path);                  /* pad a filename for displaying */
  222.  
  223. int istextfile(char *path);                        /* TRUE when path is a text file */
  224.  
  225. /*******************************\
  226. *                                *
  227. *          Path Functions            *
  228. *                                *
  229. \*******************************/
  230.  
  231. int fillpath(char *path);                /* block path fill */
  232. int fillpathall(void);                    /* block path fill for all drives */
  233. void freepaths(void);                    /* free paths */
  234. char *getpath(int index);                /* get a path */
  235.  
  236. /*******************************\
  237. *                                *
  238. *   Unix conversion functions   *
  239. *                                *
  240. \*******************************/
  241.  
  242. int isunix(void);                        /* unix mode flag */
  243. char *tounix(char *cmd);                /* convert dos command to unix */
  244. char *todos(char *cmd);                    /* convert unix command to dos */
  245.  
  246. /*******************************\
  247. *                                *
  248. *  File Description Functions    *
  249. *                                *
  250. \*******************************/
  251.  
  252. char *getdesc(char *path);                /* get a file description */
  253. int setdesc(char *path, char *str);        /* set a file description */
  254. int deldesc(char *path);                /* delete a file description */
  255.  
  256. /*******************************\
  257. *                                *
  258. *    Environment Functions        *
  259. *                                *
  260. \*******************************/
  261.  
  262. char *getenvironment(char *name);        /* get WinOne environment variable */
  263. int putenvironment(char *name);            /* set WinOne environment variable */
  264.  
  265. /*******************************\
  266. *                                *
  267. *       Global Variables        *
  268. *                                *
  269. \*******************************/
  270.  
  271. HINSTANCE gethinst(void);
  272.  
  273. extern char *arg_v[];            /* argv */
  274. extern int arg_c;                /* argc */
  275. extern int errcnt;                /* perror counter */
  276.  
  277. extern int main(void);    /* program entry point */
  278.  
  279. #ifdef __cplusplus
  280. }
  281. #endif  /* __cplusplus */
  282.  
  283. #endif    /* __WOIO_H */
  284.